#include "GameScore.h"
#include "GraphicFactory.h"
#include "BltInfo.h"
#include "Maze.h"

namespace Implement
{
	using namespace Graphics;

	GameScore::GameScore(Maze* pMaze):
	  TileNum(GraphicFactory::getInstance()->GetDrawableFromCache("num")),
	  Button(Position(0,0),pMaze->GetBlockSize()),
	  m_Pos(0,0),
	  m_pMaze(pMaze)
	  
	{
		this->GetInfo().SetOpacity(64);
		//this->GetInfo().SetColor(Color(255,0,0,80));
		this->GetInfo().GetDiffuse()[0] = Color(0,160,255);
		this->GetInfo().GetDiffuse()[1] = Color(255,160,0);
		this->GetInfo().GetDiffuse()[2] = Color(0,160,0);
		this->GetInfo().GetDiffuse()[3] = Color(0,0,255);
		//this->GetInfo().SetTone(Color(255,0,0));
	}
	const Position& GameScore::GetPos(void)
	{
		m_Pos = m_pMaze->GetGridPositionFromBlockPosition(m_pos);
		return m_Pos;
	}
	int GameScore::GetSequence(void)
	{
		return 1;
	}
	bool GameScore::RenderImpl()
	{
		m_size = this->GetSize();
		this->SetValue(m_pMaze->GetMoney());
		return TileNum::RenderImpl();
	}

	void GameScore::OnMouseIn(const Core::Devices::MouseEvent& mouse)
	{
		this->GetInfo().SetOpacity(64);
	}
	void GameScore::OnMouseOut(const Core::Devices::MouseEvent& mouse)
	{
		this->GetInfo().SetOpacity(255);
	}
}
